package model

import "database/sql"

type DocumentsDocument struct {
	ResCommon
	MessageMainAttachmentId sql.NullInt64
	EmailCC                 sql.NullString
	AttachmentId            int64
	Attachment              IrAttachment
	IsEditableAttachment    bool
	FileSize                int64
	ResModel                string
	ResId                   int64
	Name                    string
	Active                  bool
	Url                     sql.NullString
	Type                    string
	PartnerId               int64
	OwnerId                 int64
	LockUid                 sql.NullInt64
	FolderId                int64
	Folder                  DocumentsFolder `gorm:"foreignKey:Id;references:FolderId"`
	Handler                 string
}

// DocumentsDocumentPerm 文档权限
type DocumentsDocumentPerm struct {
	ResCommon
	DocumentId   int64
	UserId       int64
	Qty          int
	PermRead     bool
	PermWrite    bool
	PermUnlink   bool
	PermPrint    bool
	PermDownload bool
}

// DocumentsDocumentResUsersRel 文档用户
type DocumentsDocumentResUsersRel struct {
	DocumentsDocumentId int64
	ResUsersId          int64
}
type DocumentsFolder struct {
	ResCommon
	CompanyId         sql.NullInt64
	ParentFolderId    sql.NullInt64
	Name              string
	Description       sql.NullString
	Sequence          int
	UserSpecific      bool
	UserSpecificWrite bool
}

// DocumentsFolderReadGroups 文件夹读权限
type DocumentsFolderReadGroups struct {
	DocumentsFolderId int64
	ResGroupsId       int64
}

// DocumentsFolderResGroupsRel 文件夹写权限
type DocumentsFolderResGroupsRel struct {
	DocumentsFolderId int64
	ResGroupsId       int64
}

// DocumentsFolderPerm 文件夹用户权限
type DocumentsFolderPerm struct {
	ResCommon
	FolderId     int64
	UserId       int64
	PermCreate   bool
	PermRead     bool
	PermWrite    bool
	PermUnlink   bool
	PermPrint    bool
	PermDownload bool
}

// DocumentsShare 文档分享
type DocumentsShare struct {
	ResCommon
	AliasId                       int64
	MessageMainAttachmentId       sql.NullInt64
	FolderId                      int64
	Name                          sql.NullString
	AccessToken                   string
	DateDeadline                  sql.NullTime
	Type                          string
	Domain                        sql.NullString
	Action                        string
	PartnerId                     sql.NullInt64
	OwnerId                       int64
	EmailDrop                     bool
	ActivityOption                bool
	ActivityTypeId                sql.NullInt64
	ActivitySummary               sql.NullString
	ActivityDateDeadlineRange     int
	ActivityDateDeadlineRangeType string
	ActivityNote                  sql.NullString
	ActivityUserId                sql.NullInt64
}

// DocumentsDocumentDocumentsShareRel 文件共享关联表
type DocumentsDocumentDocumentsShareRel struct {
	DocumentsShareId    int64
	DocumentsDocumentId int64
}
